<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <title>Addama Feeds</title>

    <link rel="stylesheet" type="text/css" href="https://informatics-apps.systemsbiology.net/ext-js-3.4.0/resources/css/ext-all.css">
    <link rel="stylesheet" type="text/css" href="https://informatics-apps.systemsbiology.net/ext-js-3.4.0/examples/shared/examples.css"/>
    <link rel="stylesheet" type="text/css" href="https://informatics-apps.systemsbiology.net/ext-js-3.4.0/examples/feed-viewer/feed-viewer.css"/>

    <script type="text/javascript" src="https://informatics-apps.systemsbiology.net/ext-js-3.4.0/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="https://informatics-apps.systemsbiology.net/ext-js-3.4.0/ext-all.js"></script>

    <script type="text/javascript" src="/js/utils.js"></script>
    <script type="text/javascript" src="/js/topbar.js"></script>
    <script type="text/javascript" src="/js/widgets.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/stylesheet.css"/>

    <script type="text/javascript">
        FeedGrid = Ext.extend(Object, {

            constructor: function(config) {
                Ext.apply(this, config);

                FeedGrid.superclass.constructor.call(this);

                var store = new Ext.data.Store({
                    proxy: new Ext.data.HttpProxy({ url: "/addama/feeds/announcements/rss", method: 'get' }),
                    sortInfo: { field: "pubDate", direction: "DESC" },
                    reader: new Ext.data.XmlReader(
                        {record: 'item'},
                        ['title', 'author', {name:'pubDate', type:'date'}, 'link', 'description', 'content']
                    )
                });

                this.gridPanel = new Ext.grid.GridPanel({
                    store: store,
                    autoHeight: true,
                    loadMask: { msg:'Loading Feed...' },
                    viewConfig: { forceFit:true, enableRowBody:true, showPreview:true },
                    columns: [
                        { id: 'title', header: "Title", dataIndex: 'title', sortable:true },
                        { id: 'last', header: "Date", dataIndex: 'pubDate', sortable:true },
                        { id: 'author', header: "Author", dataIndex: 'author', sortable:true }
                    ]
                });
                store.load();
            }
        });
        Ext.onReady(function() {
            new org.systemsbiology.addama.js.TopBar({ contentEl: "container_topbar" });
            new org.systemsbiology.addama.js.widgets.Viewport({
                topbarEl: "container_topbar",
                activateAjaxMonitor: true,
                tabs: [ new FeedGrid().gridPanel ]
            });
        });
    </script>
</head>
<body>
<div id="container_topbar" class="topbar"></div>
</body>
</html>